package com.example.clicboton;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;


public class MainActivity extends Activity {

	private Button btAceptar;
	private EditText uno;
	private EditText dos;
	private EditText tres;
	public float fUno=0,fDos=0,fTres=0;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btAceptar = (Button) findViewById(R.id.btnCalcular);
        btAceptar.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				uno =(EditText) findViewById(R.id.txtUno);
            	dos =(EditText) findViewById(R.id.txtDos);
            	tres =(EditText) findViewById(R.id.txtResultado);
            	fUno =Float.parseFloat(uno.getText().toString());
            	fDos =Float.parseFloat(dos.getText().toString());
            	tres.setText(Float.toString(fUno+fDos));

				
			}
		});
    }	

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}
